package src;
import java.util.ArrayList;
import java.util.Hashtable;


public class Cell {
	
	private int x;
	private int y;
	boolean qg;
	private Individu individu;
	private Fond fond;
	private Hashtable<String,Pheromone> pheromones;	
	private Hashtable<String, ObjetMap> objets;	
	
	
	public Cell(int i, int j){ 
		x = i;
		y = j;
		pheromones = new Hashtable<String,Pheromone>();
		objets = new Hashtable<String, ObjetMap>();
	}
	
	public void setX(int x) {
		this.x = x;
	}

	public void setY(int y) {
		this.y = y;
	}

	public boolean isQg() {
		return qg;
	}

	public void setQg(boolean qg) {
		this.qg = qg;
	}

	public String toString(){
		String s = "";
		s = s+"Case ("+x+","+y+"): \n";
		if( fond != null){
			s = s +" \t Fond: "+ fond.toString()+" \n";
		}
		if( individu != null){
			s = s +" \t Individu: "+ individu.toString()+" \n";
		}
		if( objets != null){
			s = s +" \t Objet: "+ objets.toString()+" \n";
		}
		
		return s;
	}
	
	public void clear(){
		individu = null;
		pheromones.clear();
		objets.clear();
		fond = null;
	}
	

	//accesseurs
	public Individu getIndividu() {
		return individu;
	}

	
	public void setIndividu(Individu individu) {
		this.individu = individu;
	}


	public Fond getFond() {
		return fond;
	}


	public void setFond(Fond fond) {
		this.fond = fond;
	}


	public Hashtable<String,Pheromone> getPheromones() {		return pheromones;
	}


	public void setPheromones(Hashtable<String,Pheromone> pheromones) {		
		this.pheromones = pheromones;
	}


	public Hashtable<String,ObjetMap> getObjet() {
		return objets;
	}


	public void setObjet(Hashtable<String, ObjetMap> objets) {
		this.objets = objets;
	}

	public int getX() {
		return x;
	}

	
	public int getY() {
		return y;
	}
	
	public void addObjectByUser(ObjetMap o){
		String className = o.getClass().getName();
		objets.put(className, o);
	}
	
	public void addObjectByIndividu(ObjetMap o){
		// TODO test pr savoir si c un qg ou pas et agir en fonction 
	}
	
}
